import Foundation
import SwiftUI

struct Scenario: Identifiable, Hashable {
    let id = UUID()
    let title: String
    let subtitle: String
    let icon: String
    let minDurationSec: Double
    let maxDurationSec: Double
    let gradient: [Color]
    
    var hasRange: Bool { minDurationSec != maxDurationSec }
    var defaultDurationSec: Double { (minDurationSec + maxDurationSec) / 2 }
}

extension Scenario {
    static let all: [Scenario] = [
        Scenario(title: "硬质食物", subtitle: "花生、胡萝卜、苹果块等", icon: "cube.fill", minDurationSec: 60, maxDurationSec: 120, gradient: [.pink, .orange]),
        Scenario(title: "软质食物", subtitle: "米饭、面包、香蕉", icon: "fork.knife", minDurationSec: 60, maxDurationSec: 120, gradient: [.teal, .green]),
        Scenario(title: "韧性食物", subtitle: "牛肉干、口香糖", icon: "bolt.fill", minDurationSec: 120, maxDurationSec: 180, gradient: [.orange, .red]),
        Scenario(title: "安静咀嚼", subtitle: "坐姿，无背景动作", icon: "person.fill", minDurationSec: 60, maxDurationSec: 120, gradient: [.indigo, .blue]),
        Scenario(title: "走动中轻咀嚼", subtitle: "慢走或快走，轻微咀嚼", icon: "figure.walk", minDurationSec: 60, maxDurationSec: 120, gradient: [.purple, .pink]),
        Scenario(title: "说话中轻咀嚼", subtitle: "聊天、朗读时咀嚼", icon: "bubble.left.and.bubble.right.fill", minDurationSec: 60, maxDurationSec: 120, gradient: [.cyan, .blue]),
        Scenario(title: "静止", subtitle: "坐着、看手机、无动作", icon: "pause.circle.fill", minDurationSec: 120, maxDurationSec: 120, gradient: [.gray, .indigo]),
        Scenario(title: "走路", subtitle: "慢走、快走、上下楼", icon: "figure.walk.motion", minDurationSec: 180, maxDurationSec: 240, gradient: [.blue, .green]),
        Scenario(title: "说话", subtitle: "聊天、朗读、打电话", icon: "bubble.left.fill", minDurationSec: 120, maxDurationSec: 120, gradient: [.pink, .purple]),
        Scenario(title: "喝水/吞咽", subtitle: "连续喝水、吞口水", icon: "drop.fill", minDurationSec: 60, maxDurationSec: 60, gradient: [.teal, .blue]),
        Scenario(title: "点头/摇头", subtitle: "模拟头部动作", icon: "arrow.up.and.down.and.arrow.left.and.right", minDurationSec: 60, maxDurationSec: 60, gradient: [.orange, .yellow]),
        Scenario(title: "佩戴调整动作", subtitle: "拿下/重新戴耳机", icon: "ear.fill", minDurationSec: 30, maxDurationSec: 30, gradient: [.brown, .orange]),
        Scenario(title: "其他口部动作", subtitle: "打哈欠、咳嗽、清嗓、笑", icon: "face.smiling", minDurationSec: 60, maxDurationSec: 60, gradient: [.purple, .indigo])
    ]
}

struct Session: Identifiable, Hashable {
    let id = UUID()
    let scenario: Scenario
    let startDate: Date
    let endDate: Date
    let durationSec: Double
    var note: String?
}
